﻿namespace Sidvall.IO
{
    public class FileTypeChoice
    {
        #region Public Members

        public string Name { get; set; }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public Sidvall.Data.NameCollection FileTypeFilter { get; set; }

        #region ToString

        public override string ToString()
        {
            var filter = "";
            foreach (var fileTypeFilter in this.FileTypeFilter)
            {
                if (!string.IsNullOrWhiteSpace(filter))
                    filter += ";";
                filter += "*" + fileTypeFilter;
            }
            return this.Name + " (" + filter + ")|" + filter;
        }

        #endregion

        #endregion
        #region Constructors

        public FileTypeChoice()
        {
            this.FileTypeFilter = new Sidvall.Data.NameCollection();
        }

        #endregion
    }
}
